package main

//增加设备结构
type DevAdd struct {
	UID string
	IP  string
	Adr string
}

type AddDev struct {
	REQ string
	Dev []DevAdd
}

type ResAddDev struct {
	RES  string
	Ok   []string
	Fail []string
}

//删除设备
type RemoveDev struct {
	REQ string
	Dev []DevMsg
}

type ResRemoveDev struct {
	RES string
	Ok  []string
}

//获取设备信息
type GetBaseMsg struct {
	REQ string
	Dev []DevMsg
}

type DevMsg struct {
	UID string
}

type ResDev struct {
	UID     string
	Conect  string
	FwVer   string
	Sys     ResSys
	AutoSw  ResAutoSw
	Pow     ResPow
	Envi    ResEnvi
	CamDrop map[string]ResCaml //ResCamDrop
	SPD     ResSPD
}
type ResAutoSw struct {
	State string
	Irms  string
	Leak  string
	AC220 ResValue
}

type ResEnvi struct {
	Tem     ResValue
	Hum     ResValue
	InWater string
	Door    ResDoor
	Acc     ResAcc
	Shock   ResShock
	Fan     ResFan
}
type ResCamDrop struct {
	Caml ResCaml
}
type ResSPD struct {
	Status string
	Times  string
}

type ResCaml struct {
	B string
	P string
}

type ResFan struct {
	State string
	Speed string
}

type ResShock struct {
	State string
	Times string
}

type ResAcc struct {
	State string
	X     string
	Y     string
	Z     string
}

type ResDoor struct {
	Open string
	Auth string
}

type ResPow struct {
	DC12 ResValue
	AC24 ResValue
}

type ResValue struct {
	S string
	V string
}

type ResSys struct {
	State string
	IO    []int
	Dot1x string
}

type ResDevMsg struct {
	RES string
	Dev []ResDev
}

//控制灯亮度
type Light struct {
	REQ string
	Dev []DevLight
}

//设备中灯亮度结构
type DevLight struct {
	UID string
	Val string
}

//控制亮度回复
type Reslight struct {
	RES  string
	Ok   []string
	Fail []string
}

//IO控制结构
type ActPort struct {
	REQ string
	Dev []DevAct
}

type DevAct struct {
	UID string
	Act ReqAct
}
type ReqAct struct {
	Strobe *string `json:"Strobe,omitempty"`
	Latch  *string `json:"Latch,omitempty"`
}

type ResAct struct {
	RES  string
	Ok   []string
	Fail []string
}

//控制支路继电器结构
type SetOutlet struct {
	REQ    string
	UID    string
	Board  string
	Outlet string
	Act    string
}

type ResOutlet struct {
	RES string
	UID string
	Act string
}

//设置阈值
type SetConfig struct {
	REQ string
	Dev []SetScope
}

//设置阈值
type SetScope struct {
	UID   string
	Sys   *SetSys    `json:"Sys,omitempty"`
	Net   *Netconf   `json:"Net,omitempty"`
	Door  *DoorSet   `json:"Door,omitempty"`
	Scope *Scopeconf `json:"Scope,omitempty"`
	ICMP  *ICMPset   `json:"ICMP,omitempty"`
	Dot1X *Dot1Xset  `json:"Dot1X,omitempty"`
}
type SetSys struct {
	SubDev  *[]int `json:"SubDev,omitempty"`
	SysMask *[]int `json:"SysMask,omitempty"`
	IOMask  *[]int `json:"IOMask,omitempty"`
}

type Netconf struct {
	TCP *TcpConf `json:"TCP,omitempty"`
	UDP *UdpConf `json:"UDP,omitempty"`
}

type TcpConf struct {
	MAC     *string `json:"MAC,omitempty"`
	GW      *string `json:"GW,omitempty"`
	SubMask *string `json:"SubMask,omitempty"`
	IP      *string `json:"IP,omitempty"`
}

type UdpConf struct {
	Port *string `json:"Port,omitempty"`
	IP   *string `json:"IP,omitempty"`
}

type DoorSet struct {
	Delay *string
	PSW   *string
	Prot  *string
}

type Scopeconf struct {
	AC220 ValueSet
	DC12  ValueSet
	AC24  ValueSet
	Tem   ValueSet
	Hum   ValueSet
	Heat  FHSet
	Fan   FHSet
	Acc   AccSet
	Speed string
}

type ValueSet struct {
	Max string `json:"max"`
	Min string `json:"min"`
}

type FHSet struct {
	Sta string `json:"sta"`
	Sto string `json:"sto"`
}

type AccSet struct {
	Slope string `json:"slope"`
	Shock string `json:"shock"`
}

type ICMPset struct {
	Delay *string `json:"Delay,omitempty"`
	Cam0  *CamSet `json:"Cam0,omitempty"`
	Cam1  *CamSet `json:"Cam1,omitempty"`
	Cam2  *CamSet `json:"Cam2,omitempty"`
	Cam3  *CamSet `json:"Cam3,omitempty"`
	Cam4  *CamSet `json:"Cam4,omitempty"`
	Cam5  *CamSet `json:"Cam5,omitempty"`
	Cam6  *CamSet `json:"Cam6,omitempty"`
	Cam7  *CamSet `json:"Cam7,omitempty"`
}

type Dot1Xset struct {
	User string
	PSW  string
}

type CamSet struct {
	B  string
	P  string
	IP string
}

//设置成功返回
type ResConf struct {
	RES  string
	Ok   []string
	Fail []string
}

//获取设备配置结构
type GetConf struct {
	REQ string
	Dev []ConfDev
}

type ConfDev struct {
	UID string
}

//返回设备配置的结构
type ResSet struct {
	RES string
	Dev []ResSetDev
	//Conect string
}

type ResSetDev struct {
	UID    string
	Conect string
	Sys    SetSys
	Net    Netconf
	Door   DoorSet
	Scope  Scopeconf
	ICMP   ICMPset
	Dot1X  Dot1Xset
}

//设置系统控制命令
type ActSys struct {
	REQ string
	Dev []ActSysDev `json:"Dev,omitempty"`
}

type ActSysDev struct {
	UID string
	Act ActDev `json:"Act,omitempty"`
}

type ActDev struct {
	SysReset      *string `json:"SysReset,omitempty"`
	RestoreConfig *string `json:"RestoreConfig,omitempty"`
	LanReset      *string `json:"LanReset,omitempty"`
	ESwReset      *string `json:"ESwReset,omitempty"`
	SpdClear      *string `json:"SpdClear,omitempty"`
}

type ResActSys struct {
	RES  string
	Ok   []string
	Fail []string
}

//固件升级
type FwUpdate struct {
	REQ   string
	FName string
	Dev   []DevMsg
}

type ResFwUpdate struct {
	RES  string
	Ok   []string
	Fail []string
}

//设置报警屏蔽
type SysMaskConf struct {
	REQ string
	Dev []DevMask
}

type DevMask struct {
	UID string
	Sys SysM
}

type SysM struct {
	SysMask []int
}

//电源控制回路
type GetPb struct {
}
